[bits 32]
extern _cr1
global _cr0
global gdtr

[section .cr0_text]
	
_cr0:
	cli
	mov ax, 0x10
	mov ds, ax
	mov ss, ax
	lgdt [gdtr]
	jmp 0x08:(_cr1)

gdt:			dd		0
			dd		0 
kernel_code:		dw		0xffff
			dw		0x0000
			db		0x00
			db		0x98
			db	 	0xcf
			db		0x00
kernel_data:		dw		0xffff
			dw		0x0000
			db		0x00
			db		0x92
			db		0xcf
			db		0x00
video_seg		dw		0xffff
			dw		0x0000
			db		0x00
			db		0x92
			db		0xcf
			db		0x00
user_code:		dd	 	0
			dd		0
user_data:		dd	 	0
			dd		0
gdt_end:


; data structure to load the gdtr with
gdtr:
		dw		gdt_end - gdt	; size of entry
		dd		(gdt + 0x00100000)			; offset


